home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-22 | 1.8 KB | 91 lines | [TEXT/CWIE] |
- #include "Shell.h"
- #include "CFlock.h"
-
- extern Boolean gDoneFlag;
-
- extern RgnHandle gWorldRgn;
- extern struct GMParamBlock gParamBlock;
-
- // a sick hack for key control of the flock
- extern ControlRec gCurrentControls;
- extern Boolean gControlsChanged;
-
- // The global flock
- extern CFlock *gTheFlock;
-
- // local prototypes
- void DoControlClick(ControlHandle cHndl, short cPart, Point thePt);
- pascal void MyScrollProc(ControlHandle cntl, short part);
- void DrawScrollValue(ControlHandle cntl);
- void DrawScrollName(ControlHandle cntl);
-
- /*-------------------------------------------------------------------------
- DoEvent() General Event Handler...
- -------------------------------------------------------------------------*/
-
- void DoEvent(EventRecord *Event)
- {
- GrafPtr oldport;
-
- switch(Event->what)
- {
- case activateEvt:
- break;
-
- case updateEvt:
- GetPort(&oldport);
- SetPort((WindowPtr)Event->message);
- BeginUpdate((WindowPtr)Event->message);
- EndUpdate((WindowPtr)Event->message);
- SetPort(oldport);
- break;
-
- case mouseDown:
- break;
-
- case keyDown:
- case autoKey:
- DoKey(Event);
- break;
-
- case app4Evt:
- break;
-
- case nullEvent:
- if(!(Event->modifiers & alphaLock))
- {
- OSErr err;
-
- // if the controls changed, tell flock
- if(gControlsChanged)
- {
- gTheFlock->ControlsChanged(&gCurrentControls, gWorldRgn);
- gControlsChanged = false;
- }
-
- // Step the flock
- err = gTheFlock->FlockStep(gWorldRgn);
- }
- break;
- }
- }
-
-
- /*-----------------------------------------------------------------------
- DoKey() Handles keypresses...
- ------------------------------------------------------------------------*/
-
- void DoKey(EventRecord *eventptr)
- {
- char key;
-
- key = (char)(eventptr->message);
-
- FlockControlKey(key);
- if(eventptr->modifiers & cmdKey)
- {
- gDoneFlag = true;
- }
- }
-
-